package com.huizluo.module3.calstring;

public class CalString {
    //private String str = "ABCD123!@#$%ab";

    private int large;//大写数量
    private int min;//小写数量
    private int other;//其他字符数
    private int num;//数值数量

    public void count(String s){
        byte[] bs = s.getBytes();
        for (byte b: bs ) {
            if (b >= 97 && b <= 122){
                this.min++;
            }else if (b >= 65 && b<= 90){
                this.large++;
            }else if (b >= 48 && b <57){
                this.num++;
            }else{
                this.other++;
            }
        }
    }

    @Override
    public String toString() {
        return "CalString{" +
                "large=" + large +
                ", min=" + min +
                ", other=" + other +
                ", num=" + num +
                '}';
    }

    public static void main(String[] args) {
        String str = "ABCD123!@#$%ab";
        CalString cal = new CalString();
        cal.count(str);
        System.out.println(cal);
    }
}
